from django.db import models

# Create your models here.


class User(models.Model):
    """
    用户信息表
    """
    class Meta:
        verbose_name = "用户信息"
        db_table = "UserInfo"

    username = models.CharField('用户名', max_length=20, unique=True, null=False)
    password = models.CharField('密码', max_length=100, null=False)
    email = models.EmailField('邮箱', unique=True, null=False)
    createTime = models.DateTimeField('创建时间', auto_now=True)


class Token(models.Model):
    """
    用户token
    """
    class Meta:
        verbose_name = "用户token"
        db_table = "UserToken"

    user = models.OneToOneField(to=User, on_delete=models.CASCADE)
    token = models.CharField('token', max_length=50)
    createTime = models.DateTimeField('创建时间', auto_now=True)
